﻿<!DOCTYPE html>
<head>
	<meta charset="UTF-8">
	<meta name="viewport" content="width=device-width, initial-scale=1.0">
	<title>注册账号 -- 伯爵技术博客</title>
	<link href="css/font-awesome.min.css" rel="stylesheet" type="text/css">
	<link href="css/bootstrap.min.css" rel="stylesheet" type="text/css">
	<link href="images/sd.ico" type="images/x-icon" rel="shortcut icon" />
	<link href="css/bootstrap-theme.min.css" rel="stylesheet" type="text/css">
	<link rel="stylesheet" type="text/css" href="css/register.css">
	<script type="text/javascript" src="js/jquery.min.js"></script>
	<script type="text/javascript" src="js/url.js"></script>
	<script src="http://static.runoob.com/assets/jquery-validation-1.14.0/dist/jquery.validate.min.js"></script>
	<script src="js/formValidation.js"></script>
</head>
<body class="register-bg-image-2">
	<div class="container">
		<div class="col-md-12">			
			<form id="form"enctype="multipart/form-data" class="form-horizontal register-contact-form-1" role="form">
				<div class="form-group">
					<div class="col-md-12">
						<h1 class="margin-bottom-15">伯爵博客</h1>
						<p>恭喜你，成为一名<a href="#">伯爵</a> 人。注册专属于你的伯爵博客账户，让我们一起见证你的成长。伯爵有你， <a rel="nofollow" href="#"></a>更加精彩。</p>
					</div>
				</div>				
		        <div class="form-group">
		          <div class="col-md-12">		          	
		            <label for="name" class="control-label">账号 *</label>
		            <div class="register-input-icon-container">
		            	<i class="fa fa-child"></i>
		            	<input type="text" name="account" class="form-control" id="account" required minlength ="6" maxlength ="11" placeholder=""/>
		            </div>		            		            		            
		          </div>              
		        </div>
		        <div class="form-group">
		          <div class="col-md-12">
		            <label for="email" class="control-label">姓名 *</label>
		            <div class="register-input-icon-container">
		            	<i class="fa fa-user"></i>
		            	<input class="form-control" type="text" name="userName" id="userName" required maxlength ="4" placeholder="建议实名注册"/ >
		            </div>
		          </div>
		        </div>
		        <div class="form-group">
		          <div class="col-md-12">
		            <label for="website" class="control-label">密码 *</label>
		            <div class="register-input-icon-container">
		            	<i class="fa fa-lock"></i>
		            	<input class="form-control" type="password" name="password" id="password" required minlength="6" placeholder=""/>
		            </div>
		          </div>
		        </div>
		        <div class="form-group">
		          <div class="col-md-12">
		            <label for="subject" class="control-label">再输入密码 *</label>
		            <div class="register-input-icon-container">
		            	<i class="fa fa-lock"></i>
		            	<input class="form-control"  type="password" name="opassword" id="opassword" required minlength="6" placeholder=""/>
		            </div>
		          </div>
		        </div>
		        <div class="form-group">
		          <div class="col-md-12">
		            <label for="message" class="control-label">特权码 *</label>
		            <div class="register-input-icon-container">
		            	<i class="fa fa-info-circle"></i>
		            	<input class="form-control" type="password" name="authority" id="authority" required placeholder=""/>
		 
		            </div>
		          </div>
		        </div>
		   
		        <div class="form-group">
		          <div class="col-md-12">
		            <a href="onload.html">《已有账户？前去登录</a>
		            <input type="button" id="submit" value="创建账户" class="btn btn-success pull-right">
		          </div>
		        </div>	
		        <p id="message"></p>	    	
		      </form>		      
		</div>
	</div>
</body>
<script type="text/javascript">

$(document).ready(function() {

 	$("#submit").click(function(){  

		if($("#form").valid()==true)
		{
			var password = $("#password").val();
			var opassword = $("#opassword").val();
			
			if(password==opassword){
				var account = $("#account").val();
				var userName = $("#userName").val();
				var authority = $("#authority").val();
				$.post(registerURL,{
					account:account,
					userName:userName,
					password:password,
					authority:authority
					},
					function(data){
						alert(data.message);
				});
				
			}
			else{
				$("#message").text("两次密码输入不一致，请重新输入");
			}
			
		} 					        	          	 			
	});

});
</script>
</html>